package com.smartwebx.ha.web.admin.module.screen;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.smartwebx.ha.web.admin.common.HaConstant;

public class Logout{
	@Autowired
	private HttpServletResponse response;
	@Autowired
	private HttpSession session;
	
	public void execute(Context context,Navigator nav){
		//清空所有session对象
		session.invalidate();
		
		Cookie autoLogin = new Cookie("autoLogin", "");
		autoLogin.setMaxAge(-1);
		response.addCookie(autoLogin);
		
		nav.redirectTo(HaConstant.HA_LOGIN_LINK);
	}

}
